package com.secxiot.provider;

import com.secxiot.provider.communication.dto.CommunicationCreateDto;
import com.secxiot.provider.communication.dto.CommunicationDetailCreateDto;
import com.secxiot.provider.communication.vo.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

public interface CommunicationApi {

    /**
     * getPatientList:(医生查看：病患管理患者列表). <br/>
     *
     * @param userId      登录用戶id
     * @param patientName 患者名称
     * @param userType    用户类型：医生/护士
     * @return
     * @author tyra
     * @since
     */
    List<CommunicatePatientVo> getPatientList(@RequestParam(value = "userId", required = true) Long userId,
                                              @RequestParam(value = "userType", required = false) String userType,
                                              @RequestParam(value = "patientName", required = false) String patientName,
                                              @RequestParam(value = "pageNo", required = true) Long pageNo,
                                              @RequestParam(value = "pageSize", required = true) Long pageSize);

    /**
     * getDoctorList:(患者查看：我的医生列表). <br/>
     *
     * @param userId
     * @param doctorName
     * @return
     * @author tyra
     * @since
     */
    List<CommunicateDoctorVo> getDoctorList(@RequestParam(value = "userId", required = true) Long userId,
                                            @RequestParam(value = "doctorName", required = false) String doctorName,
                                            @RequestParam(value = "pageNo", required = true) Long pageNo,
                                            @RequestParam(value = "pageSize", required = true) Long pageSize);

    /**
     * updatePatientExtro:(修改患者信息（备注、床号）). <br/>
     *
     * @param patientId
     * @param memo
     * @param beds
     * @return
     * @author tyra
     * @since
     */
    boolean updatePatientExtro(@RequestParam(value = "patientId", required = true) Long patientId,
                               @RequestParam(value = "memo", required = false) String memo,
                               @RequestParam(value = "beds", required = false) String beds);

    /**
     * updateDoctorExtro:(修改医生信息（备注）). <br/>
     *
     * @param doctorId
     * @param memo
     * @return
     * @author tyra
     * @since
     */
    boolean updateDoctorExtro(@RequestParam(value = "doctorId", required = true) Long doctorId,
                              @RequestParam(value = "memo", required = true) String memo);

    /**
     * getCommunicationlist:(主题列表). <br/>
     *
     * @param doctorId  医生/护士
     * @param patientId 患者
     * @return
     * @author tyra
     * @since
     */
    List<CommunicationVo> getCommunicationlist(@RequestParam(value = "userId", required = true) Long userId,
                                               @RequestParam(value = "userType", required = true) String userType,
                                               @RequestParam(value = "doctorId", required = true) Long doctorId,
                                               @RequestParam(value = "patientId", required = false) Long patientId,
                                               @RequestParam(value = "title", required = false) String title,
                                               @RequestParam(value = "pageNo", required = true) Long pageNo,
                                               @RequestParam(value = "pageSize", required = true) Long pageSize);

    /**
     * (主题对话列表)
     *
     * @param readUserId      阅读人ID
     * @param communicationId 主题id
     * @param pageNo
     * @param pageSize
     * @return
     */
    List<CommunicationDetailVo> getCommunicationDetaillist(
            @RequestParam(value = "readUserId", required = true) Long readUserId,
            @RequestParam(value = "communicationId", required = true) Long communicationId,
            @RequestParam(value = "pageNo", required = true) Long pageNo,
            @RequestParam(value = "pageSize", required = true) Long pageSize);

    /**
     * createCommunication:(添加新话题对话). <br/>
     *
     * @param communicationCreateDto
     * @return
     * @author tyra
     * @since
     */
    @PostMapping
    Long createCommunication(@RequestBody CommunicationCreateDto communicationCreateDto);

    /**
     * createCommunicationDetail:(添加新对话). <br/>
     *
     * @param communicationCreateDetailDto
     * @return
     * @author tyra
     * @since
     */
    @PostMapping
    Long createCommunicationDetail(@RequestBody CommunicationDetailCreateDto communicationCreateDetailDto);

    /**
     * deleteCommunication:(删除主题). <br/>
     *
     * @param communicationId
     * @return
     * @author tyra
     * @since
     */
    boolean deleteCommunication(@RequestParam(value = "userId", required = true) Long userId,
                                @RequestParam(value = "communicationId", required = true) Long communicationId);

    /**
     * updateCommunicationReadFlag:(修改主题状态为已读). <br/>
     *
     * @param communicationId
     * @param readUserId      读取人的用户id
     * @return
     * @author tyra
     * @since
     */
    boolean updateCommunicationReadFlag(@RequestParam(value = "communicationId", required = true) Long communicationId,
                                        @RequestParam(value = "communicationDetailId", required = false) Long communicationDetailId,
                                        @RequestParam(value = "readUserId", required = true) Long readUserId);

    /**
     * 获取未读数量
     *
     * @param readUserId
     * @param userType
     * @return
     */
    @GetMapping("/unread/count")
    CommunicationUnreadCount getUnreadCount(@RequestParam(value = "readUserId", required = true) Long readUserId,
                                            @RequestParam(value = "userType", required = true) String userType);

    @GetMapping("/getcommunicationTalklist")
    List<CommunicationTalkVo> getcommunicationTalklist(@RequestParam(value = "talkUserId", required = true) Long talkUserId,
                                                       @RequestParam(value = "userId", required = true) Long userId,
                                                       @RequestParam(value = "pageNo", required = true) Long pageNo,
                                                       @RequestParam(value = "pageSize", required = true) Long pageSize);

    @PostMapping("/sendTalkMessage")
    Long sendTalkMessage(@RequestParam(value = "talkUserId", required = true) Long talkUserId,
                         @RequestParam(value = "userId", required = true) Long userId,
                         @RequestParam(value = "content", required = true) String content,
                         @RequestParam(value = "contentType", required = true) Integer contentType);
}
